package com.rg1906.web;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.rg1906.entity.QueryClazz;
import com.rg1906.service.impl.InsertStudentMessageServiceImpl;


@WebServlet("/QueryClass")
public class QueryClass extends HttpServlet {
	private static final long serialVersionUID = 1L;
	InsertStudentMessageServiceImpl service = new InsertStudentMessageServiceImpl();
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String gid1=request.getParameter("gid1");
		try {
			int gradeID = service.queryClazz(gid1);//得到了change后的id
			List<QueryClazz> list = service.queryClazzs(gradeID);
			String jsonString = JSON.toJSONString(list);
			response.getWriter().print(jsonString);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
